Skip to content

Offer 2036 as a US year in economy options and the v2 catalog - #3928

Open
DTrim99 wants to merge 3 commits into
masterfrom
us-2036-economy-year
Open

DTrim99 wants to merge 3 commits into
masterfrom
us-2036-economy-year

Conversation

@DTrim99

@DTrim99 DTrim99 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3927

Summary

This is the policyengine-api part of #3926: it lets US users pick 2036.

Rebased onto master on 2026-11-17, which already runs on PolicyEngine.py 6.20.0 (#4315). That bundle carries policyengine-us 2.2.2 and spm-calculator 1.1.0, whose SPM forecast covers 2022–2036, and the simulation API serves it in production. This PR therefore no longer changes the bundle; it only adds the year.

  • policyengine_api/economy_years.py: US_ECONOMY_YEARS runs from 2036 down to 2024. /us/metadata's economy_options.time_period, the v2 catalog's metadata_time_periods and the years the economy routes accept all follow it. A society-wide request for another year still gets the 400 with DATASET_YEAR_UNAVAILABLE, whose message now reads "US results are available for 2024 to 2036". The UK is unchanged (2024–2032).

  • Docs: docs/canonical-spm.md gives the artifact horizon as 2022–2036 and the US years as 2024 to 2036; docs/migration/stage-9-v2-metadata.md gives the same US years.

  • Tests: tests that used 2036 as a year after the US years now use 2037:

    • test_economy_unavailable_years.py;
    • test_spm_year_worker_polling.py, whose last accepted year is now 2036 and whose budget window runs 2036–2037;
    • test_economy_service_budget_window_requests.py's docstring and job id;
    • test_economy_years.py and test_country.py.

    test_country_spm.py's year-after-forecast case runs against the installed forecast, so it moves from 2036 to 2037. The tests on mocked forecasts with years=(2022, 2035) don't depend on the installed artifact and are unchanged.

Testing

After the rebase, against PolicyEngine.py 6.20.0 from uv.lock (uv sync --frozen --extra dev):

  • Changed tests: 36 passed, selected by node ID from test_economy_years, test_economy_unavailable_years, test_country, test_country_spm (the four year-after-forecast cases), test_economy_service_budget_window_requests and test_spm_year_worker_polling. The year-after-forecast cases read the installed forecast, so they confirm 2037 is refused and the forecast ends at 2036.
  • Lint: ruff check and ruff format --check pass on the changed Python files.

After deploy, on staging:

  • GET /us/metadata lists 2036.
  • A national 2036 economy run completes, with "2036" in its SPM receipt.
  • budget_window:2027:10 completes.
  • A society-wide request for 2037 returns DATASET_YEAR_UNAVAILABLE.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.64%. Comparing base (8819e66) to head (feac42e).
⚠️ Report is 97 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3928      +/-   ##
==========================================
- Coverage   92.30%   87.64%   -4.67%     
==========================================
  Files         300      306       +6     
  Lines       17116    18743    +1627     
  Branches     2851     3240     +389     
==========================================
+ Hits        15799    16427     +628     
- Misses        791     1741     +950     
- Partials      526      575      +49     
Flag Coverage Δ
integration 52.87% <100.00%> (-0.63%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

DTrim99 and others added 3 commits November 17, 2026 14:04
Add 2036 to the US time_period options and to the v2 catalog's
METADATA_TIME_PERIODS, and update the canonical SPM contract doc's
horizon. This must ship with the PolicyEngine bundle whose SPM forecast
covers 2036; until then a 2036 request fails with SPM_YEAR_UNAVAILABLE.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
The year-after-forecast missing-input case runs against the certified
bundle's installed forecast. Once the bundle carries spm-calculator 1.1.0,
2036 is inside the forecast, so the case moves to 2037, which is outside
both the current and the 2036 forecast.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
US_ECONOMY_YEARS now runs from 2036 down to 2024, the last year of the
canonical SPM forecast in the bundle (spm-calculator 1.1.0 covers 2022 to
2036). /us/metadata and the v2 catalog offer 2036, and the economy routes
accept it. Tests that used 2036 as a year after the US years use 2037.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@anth-volk
anth-volk force-pushed the us-2036-economy-year branch from feac42e to 83383ba Compare November 17, 2026 10:09
@anth-volk
anth-volk marked this pull request as ready for review November 17, 2026 10:14

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offer 2036 in the US economy options and v2 catalog

2 participants